﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;

namespace HML
{
    /// <summary>
    /// TrackBarPlus渐变颜色
    /// </summary>
    [TypeConverter(typeof(PropertyOrderConverter))]
    public class TrackBarPlusGradualColor
    {
        private float position = 0f;
        /// <summary>
        /// 渐变范围值 0-1
        /// </summary>
        [Description("渐变范围值 0-1")]
        [PropertyOrder(-200)]
        [DefaultValue(0f)]
        public float Position
        {
            get { return this.position; }
            set
            {
                if (value < 0)
                    value = 0;
                if (value > 1)
                    value = 1;
                if (this.position == value)
                    return;

                this.position = value;
            }
        }

        private Color color = Color.Empty;
        /// <summary>
        /// 渐变范围值对应颜色
        /// </summary>
        [Description("渐变范围值对应颜色")]
        [PropertyOrder(-198)]
        [DefaultValue(typeof(Color), "")]
        public Color Color
        {
            get { return this.color; }
            set
            {
                if (this.color == value)
                    return;
                this.color = value;
            }
        }
    }

}
